package com.duolaibei.business.view.dialog;

import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

import com.duolaibei.business.R;
import com.duolaibei.business.base.BaseDialog;
import com.duolaibei.business.utils.inject.Inject;

/**
 * Created by xlm on 2017/10/27 0027
 */

public class CustomProgressDialog extends BaseDialog {

    public CustomProgressDialog(Context context) {
        super(context, R.style.Custom_Progress);
    }

    public CustomProgressDialog(Context context, int theme) {
        super(context, theme);
    }

    @Override
    protected void onSetContentView() {
        setContentView(R.layout.progress_dialog);
    }

    @Inject(R.id.tv_message)
    private TextView tv_msg;
    private String msge;

    @Override
    protected void initViews() {
        setAnimate(R.style.animatedialog3);
    }

    @Override
    protected void onSetListener() {
        setCancelable(false);
        setCanceledOnTouchOutside(false);
    }

    @Override
    protected void afterOnCreate(Bundle savedInstanceState) {
        if (msge == null) {
            msge = " ";
        }
        tv_msg.setText(msge);
    }

    public void setMessage(String msg) {
        msge = msg;
        if (tv_msg != null) {
            tv_msg.setText(msge);
        }
    }
}
